package tool;

import base.TreeNode;

public class TreeNodeTool {

    public TreeNode leetcode236() {
        TreeNode node7 = new TreeNode(7);
        TreeNode node4 = new TreeNode(4);

        TreeNode node2 = new TreeNode(2);
        node2.left = node7;
        node2.right = node4;

        TreeNode node6 = new TreeNode(6);
        TreeNode node5 = new TreeNode(5);
        node5.left = node6;
        node5.right = node2;

        TreeNode node0 = new TreeNode(0);
        TreeNode node8 = new TreeNode(8);
        TreeNode node1 = new TreeNode(1);
        node1.left = node0;
        node1.right = node8;

        TreeNode node3 = new TreeNode(3);
        node3.left = node5;
        node3.right = node1;

        return node3;
    }

    public TreeNode leetcode226() {
        TreeNode n1 = new TreeNode(1);
        TreeNode n3 = new TreeNode(3);
        TreeNode n2 = new TreeNode(2, n1, n3);

        TreeNode n6 = new TreeNode(6);
        TreeNode n9 = new TreeNode(9);
        TreeNode n7 = new TreeNode(7, n6, n9);

        TreeNode n4 = new TreeNode(4, n2, n7);
        return n4;
    }


}
